package com.ruoyi.manage.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.manage.mapper.CrClubMapper;
import com.ruoyi.manage.domain.CrClub;
import com.ruoyi.manage.service.ICrClubService;

/**
 * 社团信息Service业务层处理
 */
@Service
public class CrClubServiceImpl implements ICrClubService
{
    @Autowired
    private CrClubMapper crClubMapper;

    /**
     * 查询社团信息
     */
    @Override
    public CrClub selectCrClubByClubId(Long clubId)
    {
        return crClubMapper.selectCrClubByClubId(clubId);
    }

    /**
     * 查询社团信息列表
     */
    @Override
    public List<CrClub> selectCrClubList(CrClub crClub)
    {
        return crClubMapper.selectCrClubList(crClub);
    }

    /**
     * 查询正常状态的社团列表
     */
    @Override
    public List<CrClub> selectActiveClubList(CrClub crClub)
    {
        return crClubMapper.selectActiveClubList(crClub);
    }

    /**
     * 根据社团类型查询社团列表
     */
    @Override
    public List<CrClub> selectClubListByType(String clubType)
    {
        return crClubMapper.selectClubListByType(clubType);
    }

    /**
     * 查询热门社团
     */
    @Override
    public List<CrClub> selectPopularClubs(int limit)
    {
        return crClubMapper.selectPopularClubs(limit);
    }

    /**
     * 新增社团信息
     */
    @Override
    public int insertCrClub(CrClub crClub)
    {
        crClub.setCreateTime(DateUtils.getNowDate());
        return crClubMapper.insertCrClub(crClub);
    }

    /**
     * 修改社团信息
     */
    @Override
    public int updateCrClub(CrClub crClub)
    {
        crClub.setUpdateTime(DateUtils.getNowDate());
        return crClubMapper.updateCrClub(crClub);
    }

    /**
     * 批量删除社团信息
     */
    @Override
    public int deleteCrClubByClubIds(Long[] clubIds)
    {
        return crClubMapper.deleteCrClubByClubIds(clubIds);
    }

    /**
     * 删除社团信息信息
     */
    @Override
    public int deleteCrClubByClubId(Long clubId)
    {
        return crClubMapper.deleteCrClubByClubId(clubId);
    }
}